package com.teach.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;

import com.teach.dto.AuthUser;
import com.teach.service.UserService;

/**<pre>
 * TODO : 用户相关业务的模拟简单实现
 * ClassName : com.teach.service.impl.UserServiceImpl
 * Author : J.L.Zhou
 * Date : 2020-03-04 17:47
 * Version : V1.0
 * Copyright 2020 jlzhou.top Inc. All rights reserved. 
 * Warning: this content is only for internal circulation of the company. It is forbidden to divulge it or use it for other commercial purposes</pre>
 */
@Service
public class UserServiceImpl implements UserService {


	@Override
	public AuthUser login(String userName, String userPwd) {
		if("admin".equals(userName)&&"123456".equals(userPwd)) {
			return new AuthUser(1L,"张三", null);
		}else if("user".equals(userName)&&"123456".equals(userPwd)) {
			return new AuthUser(2L,"李四", null);
		}else {
			throw new RuntimeException("账户不存在");
		}
	}


	@Override
	public List<AuthUser> listAll() {
		List<AuthUser> list = new ArrayList<AuthUser>();
		list.add(new AuthUser(1L,"张三", null));
		list.add(new AuthUser(2L,"李四", null));
		return list;
	}

	@Override
	public AuthUser get(Long userId) {
		return new AuthUser(userId,userId==1?"张三":"李四", null);
	}
	
	

}
